feat: implement fs2 plugin to replace @tauri-apps/plugin-fs#3033
Merged
feat: implement fs2 plugin to replace @tauri-apps/plugin-fs#3033
Conversation
Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
✅ Deploy Preview for hyprnote canceled.
|
✅ Deploy Preview for hyprnote-storybook canceled.
|
✅ Deploy Preview for howto-fix-macos-audio-selection canceled.
|
- Add readTextFile and remove commands to fs2 plugin - Implement path validation in Rust using path2's base directory - Replace all @tauri-apps/plugin-fs usages with fs2 plugin - Update test files to mock fs2 instead of @tauri-apps/plugin-fs - Remove @tauri-apps/plugin-fs dependency from package.json Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
…rmissions - Remove ping command from commands.rs, ext.rs, and lib.rs - Update build.rs to list read_text_file and remove commands - Update default.toml to list allow-read-text-file and allow-remove permissions - Remove ping.toml and add read_text_file.toml and remove.toml permission files - Regenerate TypeScript bindings Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
… into devin/1768356871-add-fs2-plugin Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
- Remove tauri-plugin-fs from Cargo.toml and lib.rs - Remove all fs: permissions from capabilities/default.json - fs2 plugin now handles path validation in Rust, no need for permission globs Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the
fs2plugin with full functionality to replace all@tauri-apps/plugin-fsusage in the codebase. The plugin performs path validation in Rust usingpath2's base directory, eliminating the need for permission globs in capabilities/default.json.Implemented commands:
read_text_file- reads text files with path validation against the app's data directoryremove- removes files or directories with path validationMigration completed:
@tauri-apps/plugin-fsimports with@hypr/plugin-fs2across 5 source files@tauri-apps/plugin-fsnpm dependency from package.jsontauri-plugin-fsRust dependency from Cargo.toml and lib.rs{ status: "ok" | "error", data?: T, error?: string }Updates since last revision
pingcommand and permission (was scaffolding from initial PR)build.rsto listread_text_fileandremovecommandsdefault.tomlpermissions toallow-read-text-fileandallow-removetauri-plugin-fsfrom both Rust (Cargo.toml, lib.rs) and npm dependenciescapabilities/default.jsonby removing allfs:*permission globs (~160 lines removed) - path validation is now handled in RustReview & Testing Checklist for Human
plugins/fs2/src/ext.rs:18-52): Verify the canonicalization and path validation correctly prevents access outside the base directory, especially for edge cases like symlinks or..traversalresult.status === "error"patterns)plugins/fs2/permissions/schemas/schema.jsonstill containsallow-ping/deny-pingreferences - verify these are cleaned up or regeneratedpnpm -r testTest plan:
ONBOARDING=0 pnpm -F desktop tauri devNotes
The path validation ensures all file operations stay within the app's data directory (from
path2.base()). This is the foundation for eventually allowing users to select their own base directory.Link to Devin run: https://app.devin.ai/sessions/2060a7b1d34f4f9985fc93a82ccbe3d9
Requested by: @yujonglee